<?php

/**
* @copyright   (C) 2010 iJoomla, Inc. - All rights reserved.
* @license  GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) 
* @author  iJoomla.com webmaster@ijoomla.com
* @url   http://www.ijoomla.com/licensing/
* the PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript  
* are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0 
* More info at http://www.ijoomla.com/licensing/
*/

defined('_JEXEC') or die('Restricted Access');
JHtml::_('behavior.tooltip');

include(JPATH_ROOT.DS."administrator".DS."components".DS."com_surveys".DS."left.php");
include(JPATH_ROOT.DS."administrator".DS."components".DS."com_surveys".DS."helpers".DS."images.php");
jimport('joomla.html.pane');

$document =& JFactory::getDocument();
$document->addStyleSheet("components/com_surveys/css/survey.css");
$document->addScript("components/com_surveys/javascript/survey.js");

$id = JRequest::getVar("id", "0");

?>


<script type="text/javascript">
	Joomla.submitbutton = function(pressbutton){
		var form = document.adminForm;		
		if (pressbutton == 'cancel') {
			submitform(pressbutton);
		}		
		else if(pressbutton == 'save' || pressbutton == 'apply') {
			if (form.title.value == ""){
				alert("Title: is a required field.");
			}						
			else{
				submitform( pressbutton );		
			}	
		}
		else{
			submitform( pressbutton );
		}
		
	}
</script>

<form action="index.php" method="post" name="adminForm" id="adminForm">
	
	<table width="100%">
		<tr>
			<td>
				<h2 style="color:#669900"><img src="<?php echo JUri::base(); ?>/components/com_surveys/images/icons/pages.png" width="48" height="48"  align="middle" />
				<?php 
				if($id != "0" ) {
					echo " " . JText::_("COM_SURVEYS_EDIT_PAGE") . "</h2>";
				}
				else{
					echo "" . JText::_("COM_SURVEYS_NEW_PAGE") . "</h2>";
				}				
				?>
			</td>
			<td align="right">
				<a target="_blank" href="http://www.ijoomla.com/redirect/survey/videos/create.htm" class="video">Video Tutorial <img src="components/com_surveys/images/icon_video.gif"></a>
			</td>
		</tr>	
	</table>
	
	<?php
		$tab = JRequest::getVar("tab", 0, "get");
		$tabs =& JPane::getInstance('Tabs', array('startOffset'=>$tab));
		echo $tabs->startPane("Surveys Pane");
		
		echo $tabs->startPanel(JText::_("COM_SURVEYS_HEADER"), 'general-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."newpage".DS."tmpl".DS."header.php"); 
		echo $tabs->endPanel();
	
		echo $tabs->startPanel(JText::_("COM_SURVEYS_IMAGES"), 'images-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."newpage".DS."tmpl".DS."images.php"); 
		echo $tabs->endPanel();
		
		echo $tabs->startPanel(JText::_("COM_SURVEYS_PUBLISHING"), 'publishing-panel'); 
			require_once(JPATH_SITE.DS."administrator".DS."components".DS."com_surveys".DS."views".DS."newpage".DS."tmpl".DS."publishing.php"); 
		echo $tabs->endPanel();
						
		echo $tabs->endPane();
	?>
	
	<input type="hidden" name="option" value="com_surveys" />
	<input type="hidden" name="controller" value="newpage" />
	<input type="hidden" name="task" value="" />
	<input type="hidden" name="boxchecked" value="0" />
	<input type="hidden" name="id" value="<?php echo $id; ?>" />
	<?php echo JHtml::_('form.token'); ?>
</form>

</td></tr></table>
<p><center><?php echo JText::_("COM_IJOOMLA_SURVEYS_POWERED_BY") ; ?>&nbsp;<a href='http://www.ijoomla.com' target='_blank'><?php echo JText::_("COM_SURVEYS_SURVEY"); ?></a></center></p>	